<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
        "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="org.springside.modules.security.domain">
    <class name="User" table="system_users" dynamic-insert="true" dynamic-update="true">
		<id name="id" type="integer">
			<column name="id" />
            <generator class="native" >
				<param name="sequence">SYSTEM_USERS_ID_SEQ</param>
            </generator>
		</id>
		<!-- 单独的表，不用使用关联

		<many-to-one name="duty" class="Duty" fetch="select" insert="false" update="false">
			<column name="duty_id" not-null="false" />
		</many-to-one>
		<many-to-one name="dept" class="Dept" fetch="select" insert="false" update="false">
			<column name="dept_id" not-null="false" />
		</many-to-one>
		-->
		<!-- 这个对应不一致 -->
		<property name="name" type="string">
			<column name="username" length="50" not-null="true" />
		</property>
		<property name="sex" type="integer">
			<column name="sex" />
		</property>
		<property name="birthday" type="date">
			<column name="birthday" length="23" />
		</property>
		<property name="pos" type="integer">
			<column name="pos" />
		</property>
		<property name="superior" type="integer">
			<column name="superior" not-null="false" />
		</property>
		<property name="created" type="timestamp">
			<column name="created" length="23" />
		</property>
		<property name="loginid" type="string">
			<column name="loginid" length="50" not-null="true" unique="true" />
		</property>
		<!-- 这个对应不一致 -->
		<property name="passwd" type="string">
			<column name="password" not-null="true" />
		</property>
		<property name="auth" type="string">
			<column name="auth" length="100" not-null="false" />
		</property>
		<property name="dynamicno" type="string">
			<column name="dynamicno" length="200" />
		</property>
		<property name="fingerprint" type="string">
			<column name="fingerprint" />
		</property>
		<property name="status" type="string">
			<column name="status" length="2" />
		</property>
		<property name="effective" type="timestamp">
			<column name="effective" length="23" />
		</property>
		<property name="expired" type="timestamp">
			<column name="expired" length="23" />
		</property>
		<property name="allowip" type="string">
			<column name="allowip" />
		</property>
		<property name="allowclient" type="integer">
			<column name="allowclient" />
		</property>
		<property name="isopen" type="string">
			<column name="isopen" />
		</property>
		<property name="mobile" type="string">
			<column name="mobile" length="25" />
		</property>
		<property name="email" type="string">
			<column name="email" length="50" />
		</property>
		<property name="email2" type="string">
			<column name="email2" length="50" />
		</property>
		<property name="homephone" type="string">
			<column name="homephone" length="50" />
		</property>
		<property name="officephone" type="string">
			<column name="officephone" length="50" />
		</property>
		<property name="address" type="string">
			<column name="address" length="100" />
		</property>
		<property name="fax" type="string">
			<column name="fax" length="100" />
		</property>
		<property name="qq" type="string">
			<column name="qq" length="25" />
		</property>
		<property name="msn" type="string">
			<column name="msn" length="50" />
		</property>
		<property name="descn" type="string">
			<column name="descn" />
		</property>
		<property name="logincount" type="integer">
			<column name="logincount" />
		</property>
		<property name="lastlogin" type="timestamp">
			<column name="lastlogin" length="23" />
		</property>
		<property name="lastloginip" type="string">
			<column name="lastloginip" length="50" />
		</property>
		<property name="lastaction" type="long">
			<column name="lastaction"/>
		</property>
		<property name="theme" type="string">
			<column name="theme" length="20" />
		</property>
		<property name="isdocumentuser" type="string">
			<column name="isdocumentuser" length="1" />
		</property>
		<property name="easuserId" type="string">
			<column name="easuser_id" length="50" />
		</property>
		<property name="employeeId" type="string">
			<column name="em_id" length="50" />
		</property>
		<property name="homePage" type="string">
			<column name="homepage" length="100" />
		</property>

		<property name="fnumber" type="string">
			<column name="fnumber" length="50" />
		</property>

		<property name="officephoneext" type="string">
			<column name="officephoneext" length="80" />
		</property>
		<property name="faxext" type="string">
			<column name="faxext" length="80" />
		</property>
		<property name="shortnumber" type="string">
			<column name="shortnumber" length="80" />
		</property>
		<property name="backupmobile" type="string">
			<column name="backupmobile" length="80" />
		</property>
		<property name="roomnumber" type="string">
			<column name="roomnumber" length="100" />
		</property>
		<property name="officeaddress" type="string">
			<column name="officeaddress" length="100" />
		</property>
		<property name="ipVail" type="integer">
			<column name="ipVail" not-null="true" default="0"/>
		</property>
		<property name="themePath" type="string">
			<column name="theme_path" length="100"/>
		</property>
		<property name="isMobileUser" type="integer">
			<column name="ismobileuser"  default="0"/>
		</property>
		<property name="pinyinKey" type="string">
			<column name="pinyinKey" length="100" />
		</property>
		
		<!-- PT056407, R111009-0403, hao_yun, 将v6.2R1中的IM集成回迁至v6.1 -->
		<property name="portal" type="integer">
			<column name="ucstar_portal" default="0" />
		</property>
		<property name="easLoginId" type="string">
			<column name="eas_loginid" length="100" />
		</property>
		
		<property name="personalMotto" type="string">
			<column name="personal_motto" />
		</property>
		<property name="isSetedNavigation" type="integer">
			<column name="isSetedNavigation"  default="0"/>
		</property>
		
		<!-- 2012-02-06,zxq,分权管理增加管理单元字段便于数据查询 -->
		<many-to-one name="uc" class="org.springside.modules.security.domain.Dept" fetch="select" insert="true" update="true">
			<column name="ucdept_id" not-null="false" />
		</many-to-one>
		
		<many-to-one name="dept" class="org.springside.modules.security.domain.Dept" fetch="select" insert="true" update="true">
			<column name="dept_id" not-null="false" />
		</many-to-one>

		<many-to-one name="duty" class="org.springside.modules.security.domain.Duty" fetch="select" insert="true" update="true">
			<column name="duty_id" not-null="false" />
		</many-to-one>


        <set name="roles" table="system_user_role" lazy="true" inverse="false" cascade="save-update" batch-size="5">
            <key>
                <column name="user_id" not-null="true"/>
            </key>
            <many-to-many class="Role" column="role_id"/>
        </set>

        <set name="menus" table="system_user_menu" lazy="true" inverse="false" cascade="save-update" batch-size="5" order-by="menu_id asc">
            <key>
                <column name="user_id" not-null="true"/>
            </key>
            <many-to-many class="Menu" column="menu_id"/>
        </set>

        <set name="addressUsers" table="address_friend_user" lazy="true" inverse="false" cascade="save-update" batch-size="5">
            <key>
                <column name="user_id" not-null="true"/>
            </key>
            <many-to-many class="cn.firstsoft.modules.address.domain.AddressUser" column="friend_id"/>
        </set>
        <set name="addressContacts" inverse="true" >
            <key>
                <column name="user_id" />
            </key>
            <one-to-many class="cn.firstsoft.modules.address.domain.AddressContact" />
        </set>
        <set name="sysPosMember" inverse="true" >
            <key>
                <column name="user_id" />
            </key>
            <one-to-many class="org.springside.modules.security.domain.SystemPositionmember" />
        </set>
        
        <set name="electronicSignature" fetch="select">
            <key column="signature_user"/>
            <one-to-many class="cn.firstsoft.modules.workflow.domain.ElectronicSignature"/>
        </set>
        
    </class>
</hibernate-mapping>
